package code.main
{
	import com.patience.mvc.context.Context;
	
	/**
	 *程序初始化 启动 
	 * @author Yuri
	 * 
	 */
	public class AppInit
	{
		private static var _instance:AppInit;
		
		private var _context:Context;
		
		public function AppInit()
		{
			if(_instance == null)
			{
				_instance = this;
				_context = new Context();
				
			}
			else{throw new Error("实例化单例类出错-AppInit");}
		}
		
		public static function getInstance():AppInit{
			if(!_instance) _instance = new AppInit();
			return _instance;
		}
		
		/**
		 * 启动程序 
		 * 
		 */
		public function start():void{
			
			var appCommonView:AppCommonView = new AppCommonView();
			var appCommonData:AppCommonData = new AppCommonData();
			_context.commonData = appCommonData;
			_context.commonView = appCommonView;
			var appC:AppController = new AppController();
			appC.start();
		}
	}
}